home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / SOUND / MP3CONV.ZIP / !MP3Conv / h / common next >
Text File  |  1998-04-08  |  20KB  |  620 lines

  1. /**********************************************************************
  2.  * ISO MPEG Audio Subgroup Software Simulation Group (1996)
  3.  * ISO 13818-3 MPEG-2 Audio Decoder - Lower Sampling Frequency Extension
  4.  *
  5.  * $Id: common.h,v 1.3 1996/03/28 03:13:37 rowlands Exp $
  6.  *
  7.  * $Log: common.h,v $
  8.  * Revision 1.3  1996/03/28 03:13:37  rowlands
  9.  * Merged layers 1-2 and layer 3 revisions
  10.  *
  11.  * Revision 1.2  1996/02/14 05:18:36  rowlands
  12.  * Cleanups.
  13.  *
  14.  * Revision 1.1  1996/02/14 03:45:52  rowlands
  15.  * Initial revision
  16.  *
  17.  * Received from FhG
  18.  **********************************************************************/
  19. /**********************************************************************
  20.  *   date   programmers         comment                               *
  21.  * 2/25/91  Doulas Wong,        start of version 1.0 records          *
  22.  *          Davis Pan                                                 *
  23.  * 5/10/91  W. Joseph Carter    Reorganized & renamed all ".h" files  *
  24.  *                              into "common.h" and "encoder.h".      *
  25.  *                              Ported to Macintosh and Unix.         *
  26.  *                              Added additional type definitions for *
  27.  *                              AIFF, double/SANE and "bitstream.c".  *
  28.  *                              Added function prototypes for more    *
  29.  *                              rigorous type checking.               *
  30.  * 27jun91  dpwe (Aware)        Added "alloc_*" defs & prototypes     *
  31.  *                              Defined new struct 'frame_params'.    *
  32.  *                              Changed info.stereo to info.mode_ext  *
  33.  *                              #define constants for mode types      *
  34.  *                              Prototype arguments if PROTO_ARGS     *
  35.  * 5/28/91  Earle Jennings      added MS_DOS definition               *
  36.  *                              MsDos function prototype declarations *
  37.  * 7/10/91  Earle Jennings      added FLOAT definition as double      *
  38.  *10/ 3/91  Don H. Lee          implemented CRC-16 error protection   *
  39.  * 2/11/92  W. Joseph Carter    Ported new code to Macintosh.  Most   *
  40.  *                              important fixes involved changing     *
  41.  *                              16-bit ints to long or unsigned in    *
  42.  *                              bit alloc routines for quant of 65535 *
  43.  *                              and passing proper function args.     *
  44.  *                              Removed "Other Joint Stereo" option   *
  45.  *                              and made bitrate be total channel     *
  46.  *                              bitrate, irrespective of the mode.    *
  47.  *                              Fixed many small bugs & reorganized.  *
  48.  *                              Modified some function prototypes.    *
  49.  *                              Changed BUFFER_SIZE back to 4096.     *
  50.  * 7/27/92  Michael Li          (re-)Ported to MS-DOS                 *
  51.  * 7/27/92  Masahiro Iwadare    Ported to Convex                      *
  52.  * 8/07/92  mc@tv.tek.com                                             *
  53.  * 8/10/92  Amit Gulati         Ported to the AIX Platform (RS6000)   *
  54.  *                              AIFF string constants redefined       *
  55.  * 8/27/93 Seymour Shlien,      Fixes in Unix and MSDOS ports,        *
  56.  *         Daniel Lauzon, and                                         *
  57.  *         Bill Truerniet                                             *
  58.  *--------------------------------------------------------------------*
  59.  * 4/23/92  J. Pineda           Added code for Layer III.             *
  60.  * 11/9/92  Amit Gulati         Added defines for layerIII stereo     *
  61.  *                              modes.                                *
  62.  *  8/24/93 Masahiro Iwadare    Included IS modification in Layer III.*
  63.  *                              Changed for 1 pass decoding.          *
  64.  *  9/07/93 Toshiyuki Ishino    Integrated Layer III with Ver 3.9.    *
  65.  *--------------------------------------------------------------------*
  66.  * 11/20/93 Masahiro Iwadare    Integrated Layer III with Ver 4.0.    *
  67.  *--------------------------------------------------------------------*
  68.  *  7/14/94 Juergen Koller      Fix for HPUX an IRIX in AIFF-Strings  *
  69.  *--------------------------------------------------------------------*
  70.  *  6/12/95 Soeren H. Nielsen   Bug fix in new_ext().                 *
  71.  *  7/11/95 Soeren H. Nielsen   Added defs. for MPEG-2 LSF            *
  72.  *--------------------------------------------------------------------*
  73.  *          Roland Bitto    Adapted to MPEG2 low sampling rate    *
  74.  *--------------------------------------------------------------------*
  75.  * 12/16/96 Johan Hagman    Adapted for Solaris (mpeg3play 0.9)   *
  76.  *--------------------------------------------------------------------*
  77.  * 04/08/98 Niall Douglas    Adapted for RISC-OS                   *
  78.  **********************************************************************/
  79.  
  80. #ifndef COMMON_H
  81. #define COMMON_H
  82.  
  83. /***********************************************************************
  84. *
  85. *  Global Conditional Compile Switches
  86. *
  87. ***********************************************************************/
  88.  
  89. /* #define    UNIX        Unix conditional compile switch */
  90. /* #define    MACINTOSH    Macintosh conditional compile switch */
  91. /* #define    MS_DOS        IBM PC conditional compile switch */
  92. /* #define    MSC60        Compiled for MS_DOS with MSC v6.0 */
  93. /* #define    AIX        AIX conditional compile switch    */
  94. /* #define    CONVEX        CONVEX conditional compile switch */
  95.  
  96. #if defined(MSC60)
  97. #ifndef MS_DOS
  98. #define MS_DOS
  99. #endif
  100. #ifndef PROTO_ARGS
  101. #define PROTO_ARGS
  102. #endif
  103. #endif
  104.  
  105. #ifdef  UNIX
  106. #define         TABLES_PATH     "tables"  /* to find data files */
  107. /* name of environment variable holding path of table files */
  108. #define         MPEGTABENV      "MPEGTABLES"
  109. #define         PATH_SEPARATOR  "/"        /* how to build paths */
  110. #endif  /* UNIX */
  111.  
  112. #ifdef  MACINTOSH
  113. #define      TABLES_PATH ":tables:"  /* where to find data files */
  114. #endif  /* MACINTOSH */
  115.  
  116. /*
  117.  * Don't define FAR to far unless you're willing to clean up the
  118.  * prototypes
  119.  */
  120. #define FAR /*far*/
  121.  
  122. #ifdef __STDC__
  123. #ifndef PROTO_ARGS
  124. #define PROTO_ARGS
  125. #endif
  126. #endif
  127.  
  128. #ifdef CONVEX
  129. #define SEEK_SET        0
  130. #define SEEK_CUR        1
  131. #define SEEK_END        2
  132. #endif
  133.  
  134. /* MS_DOS and VMS do not define TABLES_PATH, so OpenTableFile will default
  135.    to finding the data files in the default directory */
  136.  
  137. /***********************************************************************
  138. *
  139. *  Global Include Files
  140. *
  141. ***********************************************************************/
  142.  
  143. #include <math.h>
  144. #include <stdio.h>
  145. #include <stdlib.h>
  146. #include <string.h>
  147. #include "ieeefloat.h"
  148. #include "portableio.h"
  149.  
  150. #ifdef RISCOS
  151. #include <stdlib.h>
  152. #endif
  153.  
  154. #ifdef  UNIX
  155. # include    <unistd.h>
  156. #endif
  157.  
  158. #ifdef SOLARIS_SPARC
  159. # include    <fcntl.h>
  160. # include    <sys/file.h>
  161. # include    <prof.h>
  162. #endif
  163.  
  164. #ifdef SOLARIS_X86
  165. # include    <fcntl.h>
  166. # include    <sys/file.h>
  167. #endif
  168.  
  169. #ifdef SUNOS
  170. # include    <fcntl.h>
  171. # include    <sys/file.h>
  172. #endif
  173.  
  174. #ifdef LINUX
  175. # include    <sys/types.h>
  176. # include    <sys/stat.h>
  177. # include    <fcntl.h>
  178. #endif
  179.  
  180. #ifdef HPUX
  181. # include    <sys/ioctl.h>
  182. # include    <sys/fcntl.h>
  183. #endif
  184.  
  185. #ifdef AIX
  186. # include    <fcntl.h>
  187. # include    <sys/audio.h>
  188. #endif
  189.  
  190. #ifdef __sgi
  191. # include    <stdlib.h>
  192. #endif
  193.  
  194. #ifdef  MACINTOSH
  195. # include    <stdlib.h>
  196. # include    <console.h>
  197. #endif
  198.  
  199. #ifdef  MS_DOS
  200. #include        <stdlib.h>
  201. #ifdef MSC60
  202. #include        <memory.h>
  203. #else
  204. #include        <alloc.h>
  205. #include        <mem.h>
  206. #endif  /* MSC60 */
  207. #endif  /* MS_DOS */
  208.  
  209. /***********************************************************************
  210. *
  211. *  Global Definitions
  212. *
  213. ***********************************************************************/
  214.  
  215. /* General Definitions */
  216.  
  217. #ifdef  MS_DOS
  218. #define         FLOAT                   double
  219. #else
  220. #define         FLOAT                   float
  221. #endif
  222.  
  223. #ifndef FALSE
  224. # define    FALSE                   0
  225. #endif
  226. #ifndef TRUE
  227. # define    TRUE                    1
  228. #endif
  229. #define         NULL_CHAR               '\0'
  230.  
  231. #define         MAX_U_32_NUM            0xFFFFFFFF
  232. #ifndef PI
  233. #define         PI                      3.14159265358979
  234. #endif
  235.  
  236. /*#define    PI4            PI/4*/
  237. /*#define    PI64            PI/64*/
  238. #define     PI4            0.78539816339744
  239. #define     PI12            0.261799388
  240. #define     PI36            0.087266463
  241. #define     PI64            0.049087385
  242. #define     LN_TO_LOG10        0.2302585093
  243.  
  244. #define     VOL_REF_NUM        0
  245. #define     MAC_WINDOW_SIZE     24
  246.  
  247. #define     MONO            1
  248. #define     STEREO            2
  249. #define     BITS_IN_A_BYTE        8
  250. #define     WORD            16
  251. #define     MAX_NAME_SIZE        81
  252. #define     SBLIMIT         32
  253. #define     SSLIMIT         18
  254. #define     FFT_SIZE        1024
  255. #define     HAN_SIZE        512
  256. #define     SCALE_BLOCK        12
  257. #define     SCALE_RANGE        64
  258. #define     SCALE            32767    /* was 32768 */
  259. #define     CRC16_POLYNOMIAL    0x8005
  260.  
  261. /* MPEG Header Definitions - ID Bit Values */
  262. #define     MPEG_AUDIO_ID        1
  263. #define        MPEG_PHASE2_LSF        0    /* 1995-07-11 SHN */
  264.  
  265. /* MPEG Header Definitions - Mode Values */
  266.  
  267. #define         MPG_MD_STEREO           0
  268. #define         MPG_MD_JOINT_STEREO     1
  269. #define         MPG_MD_DUAL_CHANNEL     2
  270. #define         MPG_MD_MONO             3
  271.  
  272. /* Mode Extention */
  273.  
  274. #define         MPG_MD_LR_LR             0
  275. #define         MPG_MD_LR_I              1
  276. #define         MPG_MD_MS_LR             2
  277. #define         MPG_MD_MS_I              3
  278.  
  279. /* AIFF Definitions */
  280.  
  281. #define IFF_ID_FORM 0x464f524d /* "FORM" */
  282. #define IFF_ID_AIFF 0x41494646 /* "AIFF" */
  283. #define IFF_ID_COMM 0x434f4d4d /* "COMM" */
  284. #define IFF_ID_SSND 0x53534e44 /* "SSND" */
  285. #define IFF_ID_MPEG 0x4d504547 /* "MPEG" */
  286.  
  287. #define AIFF_FORM_HEADER_SIZE 12
  288. #define AIFF_SSND_HEADER_SIZE 16
  289.  
  290.  
  291. typedef struct  blockAlign_struct {
  292.     unsigned long   offset;
  293.     unsigned long   blockSize;
  294. } blockAlign;
  295.  
  296. typedef struct  IFF_AIFF_struct {
  297.     short           numChannels;
  298.     unsigned long   numSampleFrames;
  299.     short           sampleSize;
  300.     double          sampleRate;
  301.     unsigned long   sampleType;
  302.     blockAlign      blkAlgn;
  303. } IFF_AIFF;
  304.  
  305. enum byte_order { order_unknown, order_bigEndian, order_littleEndian };
  306. extern enum byte_order NativeByteOrder;
  307.  
  308. /* "bit_stream.h" Definitions */
  309.  
  310. #define         MINIMUM         4    /* Minimum size of the buffer in bytes */
  311. #define         MAX_LENGTH      32   /* Maximum length of word written or
  312.                                         read from bit stream */
  313. #define         READ_MODE       0
  314. #define         WRITE_MODE      1
  315. #define         ALIGNING        8
  316. #define         BINARY          0
  317. #define         ASCII           1
  318. #ifndef BS_FORMAT
  319. #define         BS_FORMAT       ASCII /* BINARY or ASCII = 2x bytes */
  320. #endif
  321. #define         BUFFER_SIZE     4096
  322.  
  323. #ifndef MIN
  324. #define         MIN(A, B)       ((A) < (B) ? (A) : (B))
  325. #endif
  326. #ifndef MAX
  327. #define         MAX(A, B)       ((A) > (B) ? (A) : (B))
  328. #endif
  329.  
  330. /* Select float or double precision*/
  331. #ifdef FSINGLE
  332. # define    REAL        float
  333. #else
  334. # define    REAL        double
  335. #endif
  336.  
  337. /***********************************************************************
  338. *
  339. *  Global Type Definitions
  340. *
  341. ***********************************************************************/
  342. typedef struct {
  343.     char    encoded_file_name[MAX_NAME_SIZE];
  344.     char    decoded_file_name[MAX_NAME_SIZE];
  345.     int  need_aiff;
  346.     int  need_esps;
  347.     int  write_to_file;
  348.     int  topSb;
  349.     /* Added Johan H*/
  350.     int  verbose;
  351.     int  forkoff;
  352. } Arguments_t;
  353.  
  354. /* Structure for Reading Layer II Allocation Tables from File */
  355.  
  356. typedef struct {
  357.     unsigned int    steps;
  358.     unsigned int    bits;
  359.     unsigned int    group;
  360.     unsigned int    quant;
  361. } sb_alloc, *alloc_ptr;
  362.  
  363. typedef sb_alloc        al_table[SBLIMIT][16];
  364.  
  365. /* Header Information Structure */
  366.  
  367. typedef struct {
  368.     int version;
  369.     int lay;
  370.     int error_protection;
  371.     int bitrate_index;
  372.     int sampling_frequency;
  373.     int padding;
  374.     int extension;
  375.     int mode;
  376.     int mode_ext;
  377.     int copyright;
  378.     int original;
  379.     int emphasis;
  380. } layer, *the_layer;
  381.  
  382. /* Parent Structure Interpreting some Frame Parameters in Header */
  383.  
  384. typedef struct {
  385.     layer       *header;        /* raw header information */
  386.     int         actual_mode;    /* when writing IS, may forget if 0 chs */
  387.     al_table    *alloc;         /* bit allocation table read in */
  388.     int         tab_num;        /* number of table as loaded */
  389.     int         stereo;         /* 1 for mono, 2 for stereo */
  390.     int         jsbound;        /* first band of joint stereo coding */
  391.     int         sblimit;        /* total number of sub bands */
  392. } frame_params;
  393.  
  394. /* Double and SANE Floating Point Type Definitions */
  395.  
  396. typedef struct  IEEE_DBL_struct {
  397.     unsigned long   hi;
  398.     unsigned long   lo;
  399. } IEEE_DBL;
  400.  
  401. typedef struct  SANE_EXT_struct {
  402.     unsigned long   l1;
  403.     unsigned long   l2;
  404.     unsigned short  s1;
  405. } SANE_EXT;
  406.  
  407.  
  408. /* "bit_stream.h" Type Definitions */
  409.  
  410. typedef struct  bit_stream_struc {
  411.     FILE        *pt;            /* pointer to bit stream device */
  412.     unsigned char *buf;         /* bit stream buffer */
  413.     int         buf_size;       /* size of buffer (in number of bytes) */
  414.     long        totbit;         /* bit counter of bit stream */
  415.     int         buf_byte_idx;   /* pointer to top byte in buffer */
  416.     int         buf_bit_idx;    /* pointer to top bit of top byte in buffer */
  417.     int         mode;           /* bit stream open in read or write mode */
  418.     int         eob;            /* end of buffer index */
  419.     int         eobs;           /* end of bit stream flag */
  420.     char        format;
  421.  
  422.     /* format of file in rd mode (BINARY/ASCII) */
  423. } Bit_stream_struc;
  424.  
  425. /* Layer III side information. */
  426. typedef struct {
  427.     unsigned part2_3_length;
  428.     unsigned big_values;
  429.     unsigned global_gain;
  430.     unsigned scalefac_compress;
  431.     unsigned window_switching_flag;
  432.     unsigned block_type;
  433.     unsigned mixed_block_flag;
  434.     unsigned table_select[3];
  435.     unsigned subblock_gain[3];
  436.     unsigned region0_count;
  437.     unsigned region1_count;
  438.     unsigned preflag;
  439.     unsigned scalefac_scale;
  440.     unsigned count1table_select;
  441. } my_gr_info ;
  442.  
  443. typedef struct {
  444.     unsigned main_data_begin;
  445.     unsigned private_bits;
  446.     struct {
  447.         unsigned scfsi[4];
  448.         struct gr_info_s {
  449.             unsigned part2_3_length;
  450.             unsigned big_values;
  451.             unsigned global_gain;
  452.             unsigned scalefac_compress;
  453.             unsigned window_switching_flag;
  454.             unsigned block_type;
  455.             unsigned mixed_block_flag;
  456.             unsigned table_select[3];
  457.             unsigned subblock_gain[3];
  458.             unsigned region0_count;
  459.             unsigned region1_count;
  460.             unsigned preflag;
  461.             unsigned scalefac_scale;
  462.             unsigned count1table_select;
  463.             } gr[2];
  464.         } ch[2];
  465.     } III_side_info_t;
  466.  
  467. /* Layer III scale factors. */
  468.  
  469. typedef struct {
  470.     int l[23];            /* [cb] */
  471.     int s[3][13];         /* [window][cb] */
  472.     } III_scalefac_t[2];  /* [ch] */
  473.  
  474. /***********************************************************************
  475. *
  476. *  Global Variable External Declarations
  477. *
  478. ***********************************************************************/
  479.  
  480. extern char     *mode_names[5];
  481. extern char     *layer_names[3];
  482. extern char    *version_names[2];
  483. extern double   s_freq[2][4];
  484. extern int      bitrate[2][3][15];
  485. extern REAL FAR multiple[64];
  486.  
  487. /***********************************************************************
  488. *
  489. *  Global Function Prototype Declarations
  490. *
  491. ***********************************************************************/
  492.  
  493. /* The following functions are in the file "common.c" */
  494.  
  495. #ifdef  PROTO_ARGS
  496. extern FILE           *OpenTableFile(char*);
  497. extern int            read_bit_alloc(int, al_table*);
  498. extern int            pick_table(frame_params*);
  499. extern int            js_bound(int, int);
  500. extern void           hdr_to_frps(frame_params*);
  501. extern void           WriteHdr(frame_params*, FILE*);
  502. extern void           WriteBitAlloc(unsigned int[2][SBLIMIT], frame_params*,
  503.                         FILE*);
  504. extern void           WriteScale(unsigned int[2][SBLIMIT],
  505.                         unsigned int[2][SBLIMIT], unsigned int[2][3][SBLIMIT],
  506.                         frame_params*, FILE*);
  507. extern void           WriteSamples(int, unsigned int FAR [SBLIMIT],
  508.                         unsigned int[SBLIMIT], frame_params*, FILE*);
  509. extern int            NumericQ(char*);
  510. extern int            BitrateIndex(int, int, int);
  511. extern int            SmpFrqIndex(long, int*);
  512. extern int            memcheck(char*, int, int);
  513. extern void           FAR *mem_alloc(unsigned long, char*);
  514. extern void           mem_free(void**);
  515. extern void           double_to_extended(double*, char[10]);
  516. extern void           extended_to_double(char[10], double*);
  517. extern int            aiff_read_headers(FILE*, IFF_AIFF*);
  518. extern int            aiff_seek_to_sound_data(FILE*);
  519. extern int            aiff_write_headers(FILE*, IFF_AIFF*);
  520. extern void          refill_buffer(Bit_stream_struc*);
  521. extern void          empty_buffer(Bit_stream_struc*, int);
  522. extern void          open_bit_stream_w(Bit_stream_struc*, char*, int);
  523. extern void          open_bit_stream_r(Bit_stream_struc*, char*, int);
  524. extern void           close_bit_stream_r(Bit_stream_struc*);
  525. extern void           close_bit_stream_w(Bit_stream_struc*);
  526. extern void           alloc_buffer(Bit_stream_struc*, int);
  527. extern void           desalloc_buffer(Bit_stream_struc*);
  528. extern void           back_track_buffer(Bit_stream_struc*, int);
  529. extern unsigned int   get1bit(Bit_stream_struc*);
  530. extern void           put1bit(Bit_stream_struc*, int);
  531. extern unsigned long  look_ahead(Bit_stream_struc*, int);
  532. extern unsigned long  getbits(Bit_stream_struc*, int);
  533. extern void           putbits(Bit_stream_struc*, unsigned int, int);
  534. extern void           byte_ali_putbits(Bit_stream_struc*, unsigned int, int);
  535. extern unsigned long  byte_ali_getbits(Bit_stream_struc*, int);
  536. extern unsigned long  sstell(Bit_stream_struc*);
  537. extern int            end_bs(Bit_stream_struc*);
  538. extern int            seek_sync(Bit_stream_struc*, long, int);
  539. extern void           I_CRC_calc(frame_params*, unsigned int[2][SBLIMIT],
  540.                         unsigned int*);
  541. extern void           II_CRC_calc(frame_params*, unsigned int[2][SBLIMIT],
  542.                         unsigned int[2][SBLIMIT], unsigned int*);
  543. extern void           update_CRC(unsigned int, unsigned int, unsigned int*);
  544. extern void           read_absthr(FLOAT*, int);
  545. extern unsigned int   hget1bit(); /* MI */
  546. extern unsigned long  hgetbits(int);
  547. extern unsigned long  hsstell();
  548. extern void           hputbuf(unsigned int,int);
  549. extern void           rewindNbytes( int );
  550. enum byte_order DetermineByteOrder();
  551. void SwapBytesInWords( short *loc, int words );
  552.  
  553.  
  554.  
  555. #ifdef  MACINTOSH
  556. extern void           set_mac_file_attr(char[MAX_NAME_SIZE], short, OsType,
  557.                         OsType);
  558. #endif
  559. #ifdef MS_DOS
  560. extern char           *new_ext(char *filename, char *extname);
  561. #endif
  562.  
  563. #else
  564. extern FILE           *OpenTableFile();
  565. extern int            read_bit_alloc();
  566. extern int            pick_table();
  567. extern int            js_bound();
  568. extern void           hdr_to_frps();
  569. extern void           WriteHdr();
  570. extern void           WriteBitAlloc();
  571. extern void           WriteScale();
  572. extern void           WriteSamples();
  573. extern int            NumericQ();
  574. extern int            BitrateIndex();
  575. extern int            SmpFrqIndex();
  576. extern int            memcheck();
  577. extern void           FAR *mem_alloc();
  578. extern void           mem_free();
  579. extern void           double_to_extended();
  580. extern void           extended_to_double();
  581. extern int            aiff_read_headers();
  582. extern int            aiff_seek_to_sound_data();
  583. extern int            aiff_write_headers();
  584. extern void           refill_buffer();
  585. extern void           empty_buffer();
  586. extern void           open_bit_stream_w();
  587. extern void           open_bit_stream_r();
  588. extern void           close_bit_stream_r();
  589. extern void           close_bit_stream_w();
  590. extern void           alloc_buffer();
  591. extern void           desalloc_buffer();
  592. extern void           back_track_buffer();
  593. extern unsigned int   get1bit();
  594. extern void           put1bit();
  595. extern unsigned long  look_ahead();
  596. extern unsigned long  getbits();
  597. extern void           putbits();
  598. extern void           byte_ali_putbits();
  599. extern unsigned long  byte_ali_getbits();
  600. extern unsigned long  sstell();
  601. extern int            end_bs();
  602. extern int            seek_sync();
  603. extern void           I_CRC_calc();
  604. extern void           II_CRC_calc();
  605. extern void           update_CRC();
  606. extern void           read_absthr();
  607.  
  608. extern unsigned int   hget1bit();
  609. extern unsigned long  hgetbits();
  610. extern unsigned long  hsstell();
  611. extern void           hputbuf();
  612. extern void           rewindNbytes();
  613.  
  614. #ifdef MS_DOS
  615. extern char           *new_ext();
  616. #endif
  617. #endif
  618. #endif
  619. /* #define write my_write */
  620.